home *** CD-ROM | disk | FTP | other *** search
- /*
- * rcString.h - class definition for reference counted string
- * manipulations.
- *
- * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
- * Igor Metz (metz@iam.unibe.ch)
- * University of Berne, Switzerland
- * All rights reserved.
- *
- * This software may be freely copied, modified, and redistributed
- * provided that this copyright notice is preserved on all copies.
- *
- * You may not distribute this software, in whole or in part, as part of
- * any commercial product without the express consent of the authors.
- *
- * There is no warranty or other guarantee of fitness of this software
- * for any purpose. It is provided solely "as is".
- *
- */
-
- #ifndef rcString_H
- #define rcString_H
-
- #include <string.h>
-
- //___________________________________________________________ rcString
- // rcString - a reference counted String class
-
- typedef char* _Char_p_;
- class rcStringRep;
- class ostream;
-
- class rcString
- {
- public:
- rcString();
- rcString(char);
- rcString(const char*);
- rcString(const rcString&);
- ~rcString();
-
- char& operator[](unsigned);
- char operator[](unsigned) const;
-
- rcString operator()(unsigned, unsigned);
-
- const rcString& operator=(char);
- const rcString& operator=(const char*);
- const rcString& operator=(const rcString&);
-
- int operator==(const rcString&) const;
- int operator==(const char*) const;
- int operator!=(const rcString&) const;
- int operator!=(const char*) const;
- int operator< (const rcString&) const;
- int operator<=(const rcString&) const;
- int operator> (const rcString&) const;
- int operator>=(const rcString&) const;
-
- const char* chars() const;
- operator const char*() const;
-
- unsigned length() const;
- int empty() const;
-
- friend rcString operator+(const rcString&, const char*);
- friend rcString operator+(const char*, const rcString&);
- friend rcString operator+(const rcString&, const rcString&);
-
- friend ostream& operator<<(ostream&, const rcString&);
-
- private:
- rcString(_Char_p_ *r);
-
- private:
- rcStringRep *rep;
- };
-
- #endif // rcString_H
-